/**
 * 笔记相关路由
 */
const express = require('express');
const router = express.Router();
const noteController = require('../controllers/noteController');
const authenticate = require('../middleware/auth');
const validator = require('../middleware/validator');

// 所有笔记路由都需要认证
router.use(authenticate);

// 获取笔记列表
router.get('/', noteController.getNotes);

// 获取单篇笔记
router.get('/:id', validator.validateIdParam(), noteController.getNote);

// 创建笔记
router.post('/', noteController.createNote);

// 更新笔记
router.put('/:id', validator.validateIdParam(), noteController.updateNote);

// 删除笔记
router.delete('/:id', validator.validateIdParam(), noteController.deleteNote);

module.exports = router; 